Tk Source Code

View Ticket
Login
Ticket UUID: 15d172dd7a3823ed29369a56e2390cef1898e7e8
Title: Enhancement: ttk combobox associated values
Type: RFE Version: 8.6
Submitter: anonymous Created on: 2015-06-10 19:58:09
Subsystem: 88. Themed Tk Assigned To: nobody
Priority: 5 Medium Severity: Minor
Status: Open Last Modified: 2016-08-22 12:25:14
Resolution: None Closed By: nobody
    Closed on:
Description:
A combobox should allow an additional argument to specify a list of internal values in addition to the current list of display values.

Separation of display and internal values would make the use of localized text in comboboxes much easier to implement.

e.g.
set val yes
::msgcat::mclocale de
ttk::combobox -values [list [::msgcat::mc yes] [::msgcat::mc no]] \
     -readonly -returnvalues [list yes no] -textvariable val

If -returnvalues is set, the current value in -textvariable should map to the display value in -values. 

Likewise upon return, the selected display value should map to the return value in 
-returnvalues and set -textvariable appropriately.

Even when there is no need for localization, this is a very common use case.

-returnvalues specified without -readonly is an error.
[llength -values] != [llength -returnvalues] is an error.
User Comments: anonymous (claiming to be [email protected]) added on 2016-02-14 15:50:22:
After looking at the way combobox is written, this would be too difficult to implement as combobox is highly dependent on its entry box child.

This is better implemented as a new widget as a wrapper around the combobox.
http://wiki.tcl.tk/41688 (part 2) has an implementation, not as a new widget but as a set of routines.